/*package com.hy.mydesktop.client.component.mvc.factory;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.extjs.gxt.desktop.client.Desktop;
import com.extjs.gxt.desktop.client.Shortcut;
import com.extjs.gxt.desktop.client.StartMenu;
import com.extjs.gxt.desktop.client.TaskBar;
import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.data.BaseModel;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.PagingLoadConfig;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.EventType;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.event.WidgetListener;
import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.widget.BoxComponent;
import com.extjs.gxt.ui.client.widget.Component;
import com.extjs.gxt.ui.client.widget.Container;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Layout;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.hy.mydesktop.client.component.factory.ButtonFactory;
import com.hy.mydesktop.client.component.factory.DesktopMenuItemFactory;
import com.hy.mydesktop.client.component.factory.ShortcutFactory;
import com.hy.mydesktop.client.component.meta.GxtComponentMetaModel;
import com.hy.mydesktop.client.component.meta.GxtMetaModelTypeEnum;
import com.hy.mydesktop.client.component.type.ComponentTypeEnum;
import com.hy.mydesktop.shared.persistence.domain.gxt.GxtComponentControllerMetaNodeModel;


*//**
 * 
 * <ul>
 * <li>开发作者：花宏宇</li>
 * <li>设计日期：2010-8-27；时间：上午11:52:08</li>
 * <li>类型名称：GxtComponentFactory</li>
 * <li>设计目的：Desktop组件的工厂，创建Desktop组件需要的各种控件：Shortcut和MenuItem</li>
 * </ul>
 * <ul>
 * <b>修订编号：</b>
 * <li>修订日期：</li>
 * <li>修订作者：</li>
 * <li>修订原因：</li>
 * <li>修订内容：</li>
 * </ul>
 *//*
public  class GxtDesktopComponentFactory {
	
	*//**
	 * 
	 * <ul>
	 * <li>方法含义：GxtComponentMetaModel信息，创建Desktop桌面，需要的控件，包括Shortcut和MenuItem两类。<br>
	 * 注；GxtComponentMetaModel必须是树形结构(只有一个根节点)
	 * </li>
	 * <li>方法作者：花宏宇</li>
	 * <li>编写日期：2010-8-28；时间：下午上午10:56:34</li>
	 * </ul>
	 * <ul>
	 * <b>修订编号：</b>
	 * <li>修订日期：</li>
	 * <li>修订作者：</li>
	 * <li>修订原因：</li>
	 * <li>修订内容：</li>
	 * </ul>
	 * @param <COMPONENT>
	 * @param gxtComponentMetaModel
	 * @return
	 *//*
	public static Desktop createGxtComponent(
			Desktop desktop,GxtComponentMetaModel gxtComponentMetaModel) {
		
		return createTreeGxtComponent(desktop,gxtComponentMetaModel);
		
	}
	*//**
	 * 根据GxtComponentMetaModel(继承BaseModel)，创建单一控件
	 * @param <COMPONENT>
	 * @param gxtComponentMetaNodeModel
	 * @return
	 *//*
	private static Desktop createBaseGxtComponent(
			Desktop desktop,GxtComponentControllerMetaNodeModel gxtComponentMetaNodeModel) {
		//BaseModel gxtComponentMetaModel=null;
		
		
				
		
		ComponentTypeEnum componentTypeEnum = gxtComponentMetaNodeModel.getComponentTypeEnum();
		
		switch (componentTypeEnum) {
		//逐一枚举出ComponentTypeEnum中所有的控件类型
			case SHORTCUT_MODEL: {
				desktop =  ShortcutFactory.createShortcut(desktop, gxtComponentMetaNodeModel);
				break;
			}
			case DESKTOP_MENUITEM_MODEL: {
				desktop =  DesktopMenuItemFactory.createMenuItem(desktop, gxtComponentMetaNodeModel);
				break;
			}
			
			default: {//当componentTypeEnum为空，或者与现有控件类型不符合时
				//component = null;
				break;
			}
			}
			return desktop;
	}
	
	*//**
	 * 
	 * <ul>
	 * <li>方法含义：创建具有树形结构的控件（GxtComponentMetaModel为树形结构）</li>
	 * <li>方法作者：花宏宇</li>
	 * <li>编写日期：2010-8-28；时间：下午上午10:53:22</li>
	 * </ul>
	 * <ul>
	 * <b>修订编号：</b>
	 * <li>修订日期：</li>
	 * <li>修订作者：</li>
	 * <li>修订原因：</li>
	 * <li>修订内容：</li>
	 * </ul>
	 * @param <COMPONENT>
	 * @param gxtComponentMetaModelList
	 * @return
	 *//*
	
	private static Desktop createTreeGxtComponent(
			Desktop desktop,GxtComponentMetaModel gxtComponentMetaModel) {
		
		//Map<GxtComponentMetaModel, COMPONENT> map = new HashMap<GxtComponentMetaModel, COMPONENT>();
				
		//获取根节点
		GxtComponentControllerMetaNodeModel root= gxtComponentMetaModel.getRoot();
		//存放遍历后，创建的控件
						
		GxtComponentControllerMetaNodeModel tempNode = null;
		tempNode = root;
		if (tempNode.getComponentTypeEnum()!=ComponentTypeEnum.DESKTOP_MODEL) {
			return null;
		}
		//获得当前节点的下一个节点
  		tempNode = gxtComponentMetaModel.getNextNode(tempNode);		  	
		Component tempComponent = null;
		//先序遍历树形结构
		while(tempNode!=null){
			  		//为当前节点创建对象（及赋值），并把它和对应的node，放入map
			desktop = createBaseGxtComponent(desktop,tempNode);
					//desktop = addDeskComponet(desktop, tempNode, tempComponent);
					*//**
					 * 创建一个控件Shortcut或MenuItem
					 * if(是Shortcut)
					 * desktop.addShortcut(shortcut)
					 * else{
					 *  TaskBar taskBar = desktop.getTaskBar();
		 			 *StartMenu startMenu = taskBar.getStartMenu();
		 			 *startMenu.setIconStyle("user");
		 			 *startMenu.setHeading("The StartMenu");
		 			 * startMenu.add(menuItem);
					 * }
					 * 
					 *//*
					
			  		//map.put(tempNode, tempComponent);
			  		//如当前节点存在父节点（即父节点为容器），则把当前节点加入到父节点之中
			  		if (gxtComponentMetaModel.getParent(tempNode)!=null) {
			  			
						//((LayoutContainer)map.get(gxtComponentMetaModel.getParent(tempNode))).add(tempComponent);
						GxtComponentMetaNodeModel parent	= gxtComponentMetaModel.getParent(tempNode);
						LayoutContainer layoutContainer = (LayoutContainer)map.get(parent);
						layoutContainer.add(tempComponent);
					}
			  		//获得当前节点的下一个节点
			  		tempNode = gxtComponentMetaModel.getNextNode(tempNode);		  	
			  		
		}
		
		//返回添加好各个控件的最终容器
		return desktop;
	}
	
	private static Desktop addDeskComponet(Desktop desktop , GxtComponentControllerMetaNodeModel node ,Component component) {
		component.get
		if(是Shortcut)
			 * desktop.addShortcut(shortcut)
			 * else{
			 *  TaskBar taskBar = desktop.getTaskBar();
			 *StartMenu startMenu = taskBar.getStartMenu();
			 *startMenu.setIconStyle("user");
			 *startMenu.setHeading("The StartMenu");
			 * startMenu.add(menuItem);
		return desktop;
		desktop.addShortcut((Shortcut)component);
		return desktop;
	}
}*/
